package com.eiisan.user.web.controller;

import com.eiisan.core.util.api.Result;
import com.eiisan.user.model.dto.UserRegisterDto;
import com.eiisan.user.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Description: UserController
 * @Author gragonfly
 * @Date 2019/6/22
 **/
@RestController
@RequestMapping("/user")
@Api(tags = "WEB - 用户服务接口")
public class UserController {

    @Autowired
    UserService userService;

    @PostMapping(value = "/register", name = "注册接口")
    @ApiOperation(value = "注册接口")
    public Result<Boolean> register(@RequestBody UserRegisterDto param, @RequestParam String weixinCode){
        return userService.register(param, weixinCode);
    }

    @PostMapping(value = "/existMobile", name = "查询手机号是否存在")
    @ApiOperation(value = "查询手机号是否存在(data ：true 存在,false 不存在)")
    public Result<Boolean> checkMobile(@RequestParam String mobile){
        return userService.checkMobile(mobile);
    }

}
